<template>
	<view class="content">
		<!-- <view class="" @click="changen()">
			点击
		</view> -->
		<!--监听查看 :cy="cy" :change:cy="ol.receiveName" -->
		<view id="mapTest" class="olMap" style="height: 100vh;" />
	</view>
</template>
<script module="cesiumMap" lang="renderjs">
	//视图层renderjs操作，注意此层中不能uniapp提供相关接口。
	// import '../../static/openlayer/v6.6.1-dist/ol.js'不支持此导入方式否则，打包失败
	 import * as Cesium from '@/static/Cesium/Cesium.js'
	 import '@/static/Cesium/Widgets/widgets.css'
	export default {
		data() {
			return {
				title: 'Hello',
				//打点数据源
				wrnameData:[
					{
						x: '124.76074',
						y: '41.24064',
						wrname: '公众号'
					},
					// {
					// 	x: '120.663390523',
					// 	y: '31.2341793791',
					// 	wrname: '霸道的程序猿'
					// }
				],
				pointLayer:'',
				viewer:null
			}
		},
		mounted() {
			// if (typeof window.ol === 'function') {
			// 	this.initAmap()
			// } else {
			// 	const script = document.createElement('script')
			// 	script.src = 'static/js/ol.js'//可以通过此方式导入jquery，echart库
			// 	script.onload = this.initAmap.bind(this)
			// 	document.head.appendChild(script)
			// }
			this.initAmap()
			//可以操作节点
			// console.log(document.getElementId('olMap'))
		},
		methods: {
			initAmap() {
				Cesium.Camera.DEFAULT_VIEW_RECTANGLE = Cesium.Rectangle.fromDegrees(73.5,4,135,53.5)
				this.viewer = new Cesium.Viewer('mapTest',{
					 projectionPicker: true,
						// timeline: true, //是否显示时间线控件
						terrainExaggeration: 5, //地形夸张
						animation: false,
						baseLayerPicker: true,
						fullscreenButton: false,
						geocoder: false,
						homeButton: false,
						infobox: false,
						sceneModePicker: false,
						selectionIndicator: false,
						timeline: false,
						scene3DOnly: true,
						navigationHelpButton: false,
						vrButton: false,
						shouldAnimate: true
				})
			},
		}
	}
</script>

<style>
	.content {
		width: 100%;
	}

</style>


